/*
 * File:   main.cpp
 * Author: henrya
 *
 * Created on June 12, 2009, 4:40 PM
 */

#include <stdlib.h>
#include <iostream>
#include "Shell.h"
#include "RuntimeException.h"
#include "ThreadCreationException.h"
#include "Network.h"
#include "SynchronizedPriorityQueue.h"
#include "SimpleMessage.h"
#include "SystemMessage.h"
#include "RoutingMessage.h"
using namespace std;

/*
 *
 */
int main(int argc, char** argv) {
    try {
        Shell shell;
        shell.start();
        shell.join();
    } catch (ThreadCreationException& ex) {
        cout << "ThreadCreationException: " << ex.what() << endl << "Exiting..." << endl;
        exit(-1);
    } catch (RuntimeException& ex) {
        cout << "RuntimeException: " << ex.what() << endl << "Exiting..." << endl;
        exit(-1);
    }

//	ifstream netConfStream("./netconf",ios::in);
//	    if(netConfStream==NULL){
//	        throw "go to hell";
//	    }
//	Network* net=Network::createNetwork(netConfStream);
//	net->getNodesCount();

//    vector<int> nodes;
//    nodes.push_back(2);
//    nodes.push_back(0);
//    nodes.push_back(3);
//    nodes.push_back(4);
//    RoutingTable table(2, &nodes);
//    SynchronizedPriorityQueue test;
//    SimpleMessage sm;
//    SystemMessage sym;
//    RoutingMessage rm(&table);
//    rm.setFrom(1);
//    RoutingMessage rm2(&table);
//    rm2.setFrom(2);
//    test.push(&rm);
//    test.push(&sm);
//    test.push(&rm2);
//    test.push(&sym);
//    Message* tmp=test.pop();
//    tmp = test.pop();
//    tmp = test.pop();
//    tmp = test.pop();

    return  0;
}

